﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using JKF.DataModule.SqlServerDAL;
using JKF.Entities.Model;

namespace JKF.BusinessLayer.BLL
{
    public partial class bllSALES_CONTRACT
    {
        /// <summary>
        /// 获取合同分页数据
        /// </summary>
        /// <param name="buyStart"></param>
        /// <param name="buyEnd"></param>
        /// <param name="status"></param>
        /// <param name="ownShops"></param>
        /// <param name="filter"></param>
        /// <param name="filterOp"></param>
        /// <param name="filterKey"></param>
        /// <param name="pageCurrent"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageCount"></param>
        /// <param name="rowCount"></param>
        /// <returns></returns>
        public static DataTable GetSalesContractPaging(string buyStart, string buyEnd, string status, string ownShops,
                                                       string filter, string filterOp, string filterKey, string currentUser, int pageCurrent,
                                                       int pageSize, ref int pageCount, ref int rowCount)
        {
            return dalSALES_CONTRACT.GetSalesContractPaging(buyStart, buyEnd, status, ownShops,
                                                            filter, filterOp, filterKey, currentUser, pageCurrent, pageSize,
                                                            ref pageCount, ref rowCount);
        }

        /// <summary>
        /// 返回顾客的销售合同
        /// </summary>
        /// <param name="customerKey"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public static DataTable GetCustomerSalesContract(string customerKey, string currentUser)
        {
            return dalSALES_CONTRACT.GetCustomerSalesContract(customerKey, currentUser);
        }

        /// <summary>
        /// 通过客户编号获取顾客销售合同信息
        /// </summary>
        /// <param name="customerKey"></param>
        /// <param name="currentUser"></param>
        /// <param name="pageCurrent"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageCount"></param>
        /// <param name="rowCount"></param>
        /// <returns></returns>
        public static DataTable GetSalesConstractForCustomerPaging(string customerKey, string currentUser, int pageCurrent, int pageSize, ref int pageCount, ref int rowCount)
        {
            return dalSALES_CONTRACT.GetSalesContractPaging(customerKey, currentUser, pageCurrent, pageSize, ref pageCount, ref rowCount);
        }

        /// <summary>
        /// 添加销售合同
        /// </summary>
        /// <param name="contractinfo"></param>
        /// <param name="stockOutinfo"></param>
        /// <returns></returns>
        public static bool InsertSalesContract(SALES_CONTRACTinfo contractinfo, STOCK_OUTinfo stockOutinfo, POINT_LOGinfo pointInfo)
        {
            return dalSALES_CONTRACT.InsertSalesContract(contractinfo, stockOutinfo, pointInfo);
        }

        /// <summary>
        /// 更新销售合同
        /// </summary>
        /// <param name="contractinfo"></param>
        /// <returns></returns>
        public static bool UpdateSalesContract(SALES_CONTRACTinfo contractinfo)
        {
            return dalSALES_CONTRACT.UpdateSalesContract(contractinfo);
        }

        /// <summary>
        /// 删除销售合同
        /// </summary>
        /// <param name="contractKey"></param>
        /// <returns></returns>
        public static int RemoveSalesContract(string contractKey)
        {
            return dalSALES_CONTRACT.RemoveSalesContract(contractKey);
        }

        /// <summary>
        /// 获得销售编号
        /// </summary>
        /// <returns></returns>
        public static string GetSalesContractUniqueCode(string shopCode)
        {
            return dalSALES_CONTRACT.GetSalesContractUniqueCode(shopCode);
        }
    }
}
